package com.mz.ozy.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import java.util.List;

/**
 * @author liucan on 2018/7/30.
 */
public class AppPayUtils {

    public static   boolean isAvilible(Context context, String packageName ) {

        final PackageManager packageManager = context.getPackageManager();

        // 获取所有已安装程序的包信息
        List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
        for(int i = 0; i < pinfo.size(); i++) {

            // 循环判断是否存在指定包名
            if(pinfo.get(i).packageName.equalsIgnoreCase(packageName)) {
                return true;
            }

        }
        return false;

    }
}
